<template>
  <div :style="{ color, backgroundColor }" class="my-header">{{ title }}</div>
</template>

<script>
export default {
  // props: ["title", "color", "backgroundColor"],
  props: {
    // key要接收的数据
    // 值一个约束对象
    title: {
      // 约束的数据类型
      type: String,
      // 是否必选 默认false true必选
      required: true,
    },
    color: {
      type: String,
      // 设置默认值
      default: "#fff",
    },
    backgroundColor: {
      type: String,
      default: "blue",
    },
  },
};
</script>

<style lang="less" scoped>
.my-header {
  height: 45px;
  line-height: 45px;
  text-align: center;
  background-color: #1d7bff;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
}
</style>
